import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/components/Layout'
import VueRouter from 'vue-router'

Vue.use(Router)
// 添加的方法
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}
export default new Router({
  routes: [
    {
      path: '/',
      name: 'Layout',
      component: Layout,
      //重定向到
      redirect: "userlist",
      children: [
          {
          path: 'userlist',
          name: 'userlist',
          component: () => import("@/view/user/UserList"),
            meta: {
              title: '疫苗管理系统-用户列表',
            }
          },
          {
            path: 'userinfolist',
            name: 'userinfolist',
            component: () => import("@/view/user/UserInfo"),
            meta: {
              title: '疫苗管理系统-用户信息列表',
            }
          },
          {
            path: 'typelist',
            name: 'typelist',
            component: () => import("@/view/vaccinum/TypeList"),
            meta: {
              title: '疫苗管理系统-疫苗分类列表',
            }
          },
          {
            path: 'vaccinumList',
            name: 'vaccinumList',
            component: () => import("@/view/vaccinum/VaccinumList"),
            meta: {
              title: '疫苗管理系统-疫苗列表',
            }
          },
          {
            path: 'login',
            name: 'login',
            component: () => import("@/view/Login"),
            meta: {
              title: '疫苗管理系统-登录页',
              // 不显示头部导航栏
              showHeader: true
            }
          },
      ]
    },

  ]

})
